<template>
  <div id="app">
    <!-- -------阻止默认事件------------prevent------------------>
    <a href="https://www.bilibili.com/" @click="fn">默认事件</a><br />
    <a href="https://www.bilibili.com/" @click.prevent="fn">默认事件</a>
    <!-- -------阻止事件冒泡------------stop--------------------->
    <div class="hhh2" @click="fn">
      <div class="hhh1" @click.stop="fn">
        <div class="hhh" @click.stop="fn"></div>
      </div>
    </div>
    <!-- --------------------课堂练习--------------------------->
    <!-- -------阻止事件冒泡------------stop--------------------->
    <form action="http://www.itcast.cn">
      <input type="text" value="" />
      <button @click.prevent.stop="fn">提交</button>
    </form>
  </div>
</template>

<script>
export default {
  data() {
    return {}
  },
  methods: {
    fn() {
      console.log(1)
    },
    fn1() {
      console.log(2)
    },
  },
}
</script>

<style>
.hhh {
  width: 50px;
  height: 50px;
  background-color: pink;
}
.hhh1 {
  width: 150px;
  height: 150px;
  background-color: rgb(180, 0, 30);
  display: flex;
  justify-content: center;
  align-items: center;
}
.hhh2 {
  width: 200px;
  height: 200px;
  background-color: rgb(60, 0, 10);
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
